﻿<phone:PhoneApplicationPage 
    x:Class="Wulong.Phone.Dianping.Views.YourCityView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False" 
    Style="{StaticResource TransitionPageStyle}">

    <phone:PhoneApplicationPage.Resources>
        <DataTemplate x:Name="ListItemTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}" 
                           
                           Style="{StaticResource PhoneTextLargeStyle}"
                           />
                <TextBlock Text="{Binding Pinyin}"
                           
                           Foreground="{StaticResource PhoneAccentBrush}"
                           Style="{StaticResource PhoneTextNormalStyle}"
                           />
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Name="AutoCompleteTemplate">
            <StackPanel Margin="0,7">
                <TextBlock Text="{Binding Name}"
                           Margin="8,0"
                           Style="{StaticResource PhoneTextNormalStyle}" 
                           Foreground="{StaticResource PhoneAccentBrush}" />
                <TextBlock Style="{StaticResource PhoneTextNormalStyle}"
                           Text="{Binding Pinyin}"
                           Margin="8,0,8,2"
                           Foreground="{StaticResource PhoneAccentBrush}"/>
            </StackPanel>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <ImageBrush ImageSource="/Images/PageBackground.png"/>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <adduplex:AdControl xmlns:adduplex="clr-namespace:AdDuplex;assembly=AdDuplex.AdControl.Silverlight"
                            Grid.Row="0" 
                            AppId="4135" 
                            Background="Transparent"
                            BackgroundOpacity="0.5"
                            />
        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="1" Margin="12,17,0,28">
            
            <TextBlock 
                x:Name="PageTitle" 
                Text="{Binding Path=Appi18n.My_Location, Source={StaticResource ls}}" 
                Margin="9,-7,0,0" 
                Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="2" Margin="12,0,12,0">
            <StackPanel>
                <TextBlock Text="{Binding Path=Appi18n.Input_City, Source={StaticResource ls}}"
                           Foreground="#4f391e"
                           Style="{StaticResource PhoneTextNormalStyle}"/>
                <toolkit:AutoCompleteBox 
                    x:Name="SelectCity"
                    Background="Transparent"
                    ItemTemplate="{StaticResource AutoCompleteTemplate}"
                    ItemsSource="{Binding Cities}"
                    Margin="0,12"
                    ValueMemberPath="Name"
                    SelectionChanged="SelectCitySelectionChanged"
                    VerticalAlignment="Top"
                    />
                <toolkit:ListPicker  
                    x:Name="Cities" 
                    ItemTemplate="{StaticResource CityPickerItemTemplate}"    
                    FullModeItemTemplate="{StaticResource CityPickerFullModeItemTemplate}"  
                    HeaderTemplate="{StaticResource CityPickeHeaderTemplate}"
                    FullModeHeader="{Binding Path=Appi18n.Cities, Source={StaticResource ls}}"  
                    CacheMode="BitmapCache"
                    SelectedItem="{Binding SelectedCity, Mode=TwoWay}"
                    SelectionMode="Single"
                    Background="Transparent" 
                    />
            </StackPanel>
        </Grid>
    </Grid>
 
    
</phone:PhoneApplicationPage>
